package com.hsgene.consumables.persistence;

import com.hsgene.consumables.condition.PurchaseConditon;
import com.hsgene.consumables.domain.GeneticGoodsPurchase;
import com.hsgene.consumables.domain.ConsumablesReceiptInfo;
import com.hsgene.consumables.dto.ConsumablesInventoryInfoDto;
import com.hsgene.consumables.dto.ConsumablesSelectListInfoDto;
import com.hsgene.consumables.dto.GeneticGoodsPurchaseDto;
import com.hsgene.consumables.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 入库
 */
public interface ConsumablesReceiptRepository extends BaseMapper<ConsumablesReceiptInfo> {

    /**
     * 更新库存
     *
     * @param receiptInfoList 入库信息
     * @return
     */
    int updateInventoryInfo(@Param("receiptInfoList") List<GeneticGoodsPurchase> receiptInfoList);

    /**
     * 批量插入
     *
     * @param receiptInfos
     * @return
     */
    int insertBatch(@Param("receiptInfos") List<GeneticGoodsPurchase> receiptInfos);

    /**
     * 获取商品下拉列表
     *
     * @param size page
     * @param size size
     * @return
     */
    List<ConsumablesSelectListInfoDto> getSelectListInfo(@Param("offset") int offset, @Param("size") int size);

    /**
     * 插入入库记录操作信息
     *
     * @param receiptInfo 操作信息
     * @return
     */
    int insertReceipRecordInfo(@Param("receiptInfo") ConsumablesReceiptInfo receiptInfo);

    /**
     * 获取入库记录列表
     *
     * @param receiptNumber 入库编号
     * @param startTime     开始时间
     * @param endTime       结束时间
     * @param offset        偏移量
     * @param size          size
     * @return
     */
    List<ConsumablesReceiptInfo> getReceiptRecordInfo(@Param("receiptNumber") String receiptNumber,
                                                      @Param("startTime") String startTime,
                                                      @Param("endTime") String endTime,
                                                      @Param("offset") int offset, @Param("size") int size);

    /**
     * 获取入库详情
     *
     * @param
     * @return
     */
    List<GeneticGoodsPurchaseDto> getReceiptDetailInfo(@Param("purchaseNo") String purchaseNo);

    /**
     * 商品库存
     *
     * @param goodsId 商品id
     * @return
     */
    List<ConsumablesInventoryInfoDto> getInventoryInfoByGoodsId(@Param("goodsIds") String[] goodsId);

    /**
     * 批量入库
     * @param receiptInfos
     */
    void insertPurchase(List<GeneticGoodsPurchase> receiptInfos);

    int getPurchaseCount(@Param("condition") PurchaseConditon conditon);

    /**
     * 获取入库记录列表
     * @param condition
     * @return
     */
    List<GeneticGoodsPurchaseDto> getReceiptList(@Param("condition") PurchaseConditon condition);
}
